<?php
/* [$WindsForce] (C)Hunzhiwange.COM Since 2014.07.28.
   家居积分配置控制器($$)*/

!defined('Q_PATH') && exit;

class JiajucreditconfigController extends AController{

	public function filter_(&$arrMap){
		$arrMap['A.jiajucreditconfig_module']=array('like',"%".Q::G('jiajucreditconfig_module')."%");
		$arrMap['A.jiajucreditconfig_name']=array('like',"%".Q::G('jiajucreditconfig_name')."%");
		
		// 添加时间
		$this->getTime_('A.create_dateline',$arrMap);
	}

	public function index($sModel=null,$bDisplay=true){
		parent::index('jiajucreditconfig',false);
		$this->display(Admin_Extend::template('jiaju','jiajucreditconfig/index'));
	}

	public function add(){
		$this->display(Admin_Extend::template('jiaju','jiajucreditconfig/add'));
	}

	public function edit($sMode=null,$nId=null,$bDidplay=true){
		$nId=intval(Q::G('value','G'));
		parent::edit('jiajucreditconfig',$nId,false);
		$this->display(Admin_Extend::template('jiaju','jiajucreditconfig/add'));
	}

	public function insert($sModel=null,$nId=null){
		$nId=Q::G('value');
		parent::insert('jiajucreditconfig',$nId);
	}

	public function update($sModel=null,$nId=null){
		$nId=Q::G('value');
		parent::update('jiajucreditconfig',$nId);
	}

	public function forbid($sModel=null,$sId=null,$bApp=false){
		$nId=intval(Q::G('value','G'));
		parent::forbid('jiajucreditconfig',$nId,true);
	}

	public function resume($sModel=null,$sId=null,$bApp=false){
		$nId=intval(Q::G('value','G'));
		parent::resume('jiajucreditconfig',$nId,true);
	}

	public function foreverdelete_deep($sModel=null,$sId=null){
		$sId=Q::G('value');
		parent::foreverdelete_deep('jiajucreditconfig',$sId);
	}

	function check_module(){
		$sJiajucreditconfigModule=trim(Q::G('jiajucreditconfig_module'));
		$nId=intval(Q::G('value'));

		if(!$sJiajucreditconfigModule){
			exit('false');
		}

		// 查询条件
		$arrWhere=array();
		$arrWhere['jiajucreditconfig_module']=$sJiajucreditconfigModule;
		if($nId){
			$arrWhere['jiajucreditconfig_id']=array('neq',$nId);
		}

		$oJiajucreditconfig=JiajucreditconfigModel::F()->where($arrWhere)->setColumns('jiajucreditconfig_id')->getOne();
		if(empty($oJiajucreditconfig['jiajucreditconfig_id'])){
			exit('true');
		}else{
			exit('false');
		}
	}

}
